Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Create common FilterGroup component #560

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cmaddox5
Copy link
Contributor

Created a new reusable component for filter groups. We use them on 2 (soon to be 3) different pages and they are all implemented separately. This new component will help us maintain the styles. The UX of the filters is unchanged. The UI is also unchanged for the most part outside of some small tweak to bring certain elements in line with the designs.

@cmaddox5 cmaddox5 requested a review from a team as a code owner November 13, 2024 18:33
Copy link
Collaborator

@panentheos panentheos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactor! See a few small comments, then looks good.

@@ -0,0 +1,24 @@
.filter-group {
width: 200px;
margin-bottom: 48px;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's generally better to avoid external margins/padding on shared components. Depending on context, the caller might want different margins, and having it baked in can make the component harder to reuse. Instead, have the component take a className prop and apply it to the outer element, so callers can add their own margins via utility classes (mb-5 would do it in this case).

<FilterGroup
header="Filter by message state"
onFilterSelect={(selected) => {
const stateFilter = selected.toLowerCase() as StateFilter;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values are already lowercase, so this toLowerCase and the one below seem unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants